package com.swl.windowContoller;

import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import javax.swing.JFrame;
public class WindowController extends MouseAdapter  implements MouseMotionListener
{
	private Point point;
	private JFrame frame;
	public WindowController(JFrame frame)
    {
		point=new Point();
		this.frame=frame;
	}
	public void mousePressed(MouseEvent e)
    {
		point.x=e.getX(); 
		point.y=e.getY();
		
	}
	public void mouseDragged(MouseEvent e)
	{
		java.awt.Point location=frame.getLocation();
		frame.setLocation(location.x+e.getX()-point.x,location.y+e.getY()-point.y);
		super.mouseDragged(e);
    }
}
